package com.arturjaneczko.view.impl.clipboard.preview;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.util.ArrayList;

import javax.swing.JLabel;

import com.arturjaneczko.model.core.IModel;
import com.arturjaneczko.view.core.AView;

public class IconView extends AView {

	private JLabel label;

	public IconView(IModel model) {
		super(model);
		compositeList = new ArrayList<>();
	}

	@Override
	public void ui() {
		label = new JLabel();
		label.setText("icon");
		label.setHorizontalAlignment(JLabel.CENTER);
		label.setOpaque(false);
		label.setOpaque(false);
		label.setPreferredSize(new Dimension(22, 22));

		uiComposite(this, label, null);
	}
	
	@Override
	public void addChild(Container containerParent, Container containerChild,
			Object constraint) {
		GridBagConstraints c = (GridBagConstraints) constraint;
		c.gridx = 2;
		if (containerParent.getComponentCount() % 3 == 0)
			c.gridy++;
		containerParent.add(containerChild, constraint);
	}
}
